import axios from '@/libs/api.request'
import {checkAuth, getToken} from '@/libs/util'

class FullScreenMonitor {
  constructor() {
    this.$axios = axios;
  }

  getHardwareData = () => {
    let url='/admin/fullscreen/monitor/get/hardware/info';
    return axios.request({
      url: url,
      method: 'get',
      dataType: 'json',
      headers: {
        'Content-Type': 'text/html; charset=UTF-8',
        'token': getToken()
      },
    })
  }

  getDeviceCountByType = () => {
    let url='/admin/fullscreen/monitor/get/device/count/by/cate';
    return axios.request({
      url: url,
      method: 'get',
      dataType: 'json',
      headers: {
        'Content-Type': 'text/html; charset=UTF-8',
        'token': getToken()
      },
    })
  }

  /**
   * 设备在线统计
   * @returns {AxiosPromise}
   */
  getDeviceCountOnlineByType = () => {
    return axios.request({
      url: '/admin/fullscreen/monitor/get/device/count/online/by/cate',
      method: 'get',
      dataType: 'json',
      headers: {
        'Content-Type': 'text/html; charset=UTF-8',
        'token': getToken()
      },
    })
  }

  /**
   * 设备报警统计
   * @returns {AxiosPromise}
   */
  getDeviceAlarmCountByCate = () => {
    return axios.request({
      url: '/admin/fullscreen/monitor/get/device/alarm/count/by/cate',
      method: 'get',
      dataType: 'json',
      headers: {
        'Content-Type': 'text/html; charset=UTF-8',
        'token': getToken()
      },
    })
  }

  /**
   * 实时报警数据展示
   * @returns {AxiosPromise}
   */
  getDeviceAlarmActualForChart=()=>{
    return axios.request({
      url: '/admin/fullscreen/monitor/get/device/alarm/actual/for/chart',
      method: 'get',
      dataType: 'json',
      headers: {
        'Content-Type': 'text/html; charset=UTF-8',
        'token': getToken()
      },
    })
  }

  /**
   * 按部门统计数据
   */
  getDeviceCountByOrg=()=>{
    return axios.request({
      url: '/admin/fullscreen/monitor/get/device/count/by/org',
      method: 'get',
      dataType: 'json',
      headers: {
        'Content-Type': 'text/html; charset=UTF-8',
        'token': getToken()
      },
    })
  }
}
export default FullScreenMonitor;
